package com.kingdee.pda.ui.set_config;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioGroup;

import com.example.basecommon.utils.PreferencesUtils;
import com.example.basecommon.utils.SpeakUtils;
import com.kingdee.pda.R;
import com.kingdee.pda.entity.Warehouse;
import com.kingdee.pda.ui.activity.BaseTitleActivity;
import com.kingdee.pda.ui.widget.CleanableEditText;
import com.kingdee.pda.util.CommonUtil;
import com.kingdee.pda.util.ConstantPreference;
import com.kyleduo.switchbutton.SwitchButton;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 基础参数配置
 * Created by dlj
 * DATE 2022/4/7
 */
public class BaseConfigureActivity extends BaseTitleActivity {
    @BindView(R.id.sb_use_listener)
    SwitchButton sb_use_listener;
    @BindView(R.id.ll_content)
    LinearLayout ll_content;
    @BindView(R.id.iv_arrow_operate)
    ImageView iv_arrow_operate;


    public static void actionStartForResult(Activity context) {
        Intent intent = new Intent(context, BaseConfigureActivity.class);
        context.startActivity(intent);
    }

    @Override
    public void changeWarehouse(Warehouse warehouse) {

    }

    @Override
    protected void onActivityCreate(Bundle savedInstanceState) {
        super.onActivityCreate(savedInstanceState);
        setContentView(R.layout.activity_base_config);
    }

    @Override
    protected void initView() {
        super.initView();
        setTitle("基础参数配置");

        boolean isOpen = PreferencesUtils.getBoolean(this, ConstantPreference.MID_SN_IS_OPEN);
        sb_use_listener.setChecked(isOpen);
        sb_use_listener.setOnCheckedChangeListener((buttonView, isChecked) ->
                PreferencesUtils.putBoolean(this, ConstantPreference.MID_SN_IS_OPEN,
                        isChecked));


    }

    @Override
    protected void initData() {
        super.initData();
    }

    @OnClick({R.id.btn_fiinish, R.id.ll_open_sn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_open_sn:
                if (iv_arrow_operate.isSelected()) {
                    iv_arrow_operate.setSelected(false);
                    ll_content.setVisibility(View.VISIBLE);
                } else {
                    iv_arrow_operate.setSelected(true);
                    ll_content.setVisibility(View.GONE);
                }
                break;
            case R.id.btn_fiinish:

                finish();
                break;
        }
    }
}
